<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第三题</title>
</head>

<body>
    <script>
        function getQuchong() {
            let arr = [
                { id: 1, name: '张三', age: 18 },
                { id: 2, name: '李四', age: 20 },
                { id: 3, name: '王五', age: 15 },
                { id: 1, name: '张三', age: 18 },
                { id: 4, name: '王五', age: 19 },
            ]
            let newArr = []
            let j = 0
            for (let i = 0; i < arr.length; i++) {
                if (newArr.indexOf(arr[i].id) == -1) {
                    newArr.push(arr[i].id)
                } else {
                    arr.splice(i, 1)
                }
            }
            console.log(newArr)
            // console.log(j)
        }
        getQuchong()
    </script>
</body>

</html>